import React from 'react';
import UserContext from './UserContext';

const Child = () => {
  return (
    <UserContext.Consumer>
      {(contextValue) => {
        return (
          <div>
            <div>姓名：{contextValue.name}</div>
            <div>年龄：{contextValue.age}</div>
          </div>
        );
      }}
    </UserContext.Consumer>
  );
};

export default Child;
